Socket
Socket
Sign inDemoInstall

@skypilot/sugarbowl

Package Overview
Dependencies
0
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @skypilot/sugarbowl

A collection of convenience functions for JavaScript & TypeScript


Version published
Weekly downloads
5
decreased by-64.29%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.24.4 (2021-01-10)

Bug Fixes

  • makeTempDir fails when multiple levels are to be created (0ce692d)

Readme

Source

@skypilot/sugarbowl

npm stable stable build npm next next build Codacy grade downloads license: ISC

A collection of typed convenience functions for JavaScript & TypeScript.

All functions are typed, and it is expected that they will be used only in type-checked code. This keeps the functions lightweight: they do not carry the overhead of checking argument types or handling type coercion.

Exports

Array functions

  • flatten
  • getDuplicates
  • getFirstIntersection
  • getIntersection
  • includeIf
  • includes
  • omitSequentialDuplicateItems<I>(array: I[], { evaluate? }): I[]
  • pagesToIndices
  • pickRandomItem
  • pickRandomItems
  • pushIf
  • range(start: Integer, end: Integer): Integer[]
  • shuffle
  • toArray<T>(T | T[]): T[]
  • toUniqueArray

Date & time functions

  • isValidDate
  • sleep
  • toUnixTime(:Date, decimalPlaces?: Integer): number
  • toUnixTime(timestampInMs: number, decimalPlaces?: Integer): number
  • truncateIsoDateTime

Filesystem functions

  • findPackageFileDir
  • findUpTree
  • makeTempDir
  • readPackageFile
  • wipeDir
  • writeDataFile
  • writePackageFile

Higher-order functions

  • curry(fnToCurry: Function, ...args: any[]): Function
  • extendFunction(fnToExtend: Function, ...extendingFns: Function[]): Function
  • pipe(...fnsToPipe: Function[])
  • toMapFunction(...itemFns: Function[]): Function

Input/output functions

  • consoleIf(:boolean): (message: string) => void

Number functions

  • generateRandomInt(minValue: number, maxValue: number): Integer
  • isInteger(value: any): boolean

Object functions

  • entriesToKeyedItems(key: string, obj: object)
  • filterLeavesByKey(key: string, obj: object, options)
  • getOrDefault(obj: object, key: string, default: any)
  • isObject(value: any): boolean
  • mergeIf(conditional: any, :object)
  • omitFalsyEntries(obj: object): object
  • omitEntriesByValue(value: any, obj: object): object
  • omitUndefinedEntries(obj: object): object
  • setValueByPath(path: string | string[], value: any, target: object, options?)
  • swapKeysAndValues(obj: object): object

String functions

  • capitalizeAllWords(stringToCapitalize: string): string
  • <code>capitalizeFirstWord(stringToCapitalize: string): string
  • computeHash(stringToHash: string, length: Integer = 32): string
  • countOccurrences(str: string, substring: string): Integer
  • digitsOnly(stringToParse: string): string
  • inflectByNumber(howMany: number, singular: string, plural?: string): string
  • inflectQuantity(howMany: number, singular: string, plural?: string): string
  • isEnclosed(stringToCheck: string, startDelimiter: string, endDelimiter?: string = startDelimiter): boolean
  • nondigitsOnly(stringToParse: string): string
  • parseInteger(stringToParse: string, options): Integer
  • parseEnclosed(stringToParse: string, startDelimiter: string, endDelimiter: string = startDelimiter): string
  • randomAlphanumeric(length: Integer): string
  • removeExtraWhitespace(str: string): string
  • removeWhitespace(str: string): string
  • splitOnce(stringToSplit: string, splitter: string>): string[]
  • startsWith(string: string, substring: string, startFromPosition: Integer = 0): boolean

String.prototype wrappers

  • padEnd
  • padStart
  • toLowerCase
  • toUpperCase
  • trim
  • trimLeft
  • trimRight

Keywords

FAQs

Last updated on 10 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc